home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / Dragbar.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-07  |  4.4 KB  |  121 lines

  1. VERSION 5.00
  2. Object = "{335C3C4F-E3F2-11D0-87E8-00A0C903B29D}#5.0#0"; "VCFI5.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DragBar"
  5.    ClientHeight    =   8460
  6.    ClientLeft      =   1740
  7.    ClientTop       =   1545
  8.    ClientWidth     =   7740
  9.    LinkTopic       =   "Form1"
  10.    PaletteMode     =   1  'UseZOrder
  11.    ScaleHeight     =   8460
  12.    ScaleWidth      =   7740
  13.    Begin VtChartLib.VtChart VtChart1 
  14.       Height          =   5055
  15.       Left            =   840
  16.       TabIndex        =   0
  17.       Top             =   1680
  18.       Width           =   5775
  19.       _ExtentX        =   10186
  20.       _ExtentY        =   8916
  21.       _0              =   $"Dragbar.frx":0000
  22.       _1              =   $"Dragbar.frx":0405
  23.       _2              =   $"Dragbar.frx":080A
  24.       _3              =   $"Dragbar.frx":0C0F
  25.       _4              =   $"Dragbar.frx":1014
  26.       _5              =   $"Dragbar.frx":1419
  27.       _6              =   $"Dragbar.frx":181E
  28.       _7              =   $"Dragbar.frx":1C23
  29.       _8              =   $"Dragbar.frx":2028
  30.       _9              =   $"Dragbar.frx":242D
  31.       _10             =   $"Dragbar.frx":2832
  32.       _11             =   $"Dragbar.frx":2C37
  33.       _12             =   $"Dragbar.frx":303C
  34.       _13             =   $"Dragbar.frx":3441
  35.       _count          =   14
  36.       _ver            =   1
  37.    End
  38.    Begin VB.Label Label2 
  39.       Caption         =   "Click on a bar and drag the bar while holding down the mouse button.  The bar height will automatically be adjusted."
  40.       Height          =   375
  41.       Left            =   240
  42.       TabIndex        =   2
  43.       Top             =   960
  44.       Width           =   6855
  45.    End
  46.    Begin VB.Label Label1 
  47.       Caption         =   "Simple First Impression Dragging Example"
  48.       BeginProperty Font 
  49.          Name            =   "MS Sans Serif"
  50.          Size            =   12
  51.          Charset         =   0
  52.          Weight          =   700
  53.          Underline       =   0   'False
  54.          Italic          =   0   'False
  55.          Strikethrough   =   0   'False
  56.       EndProperty
  57.       ForeColor       =   &H00FF0000&
  58.       Height          =   435
  59.       Left            =   240
  60.       TabIndex        =   1
  61.       Top             =   360
  62.       Width           =   6855
  63.    End
  64. Attribute VB_Name = "Form1"
  65. Attribute VB_GlobalNameSpace = False
  66. Attribute VB_Creatable = False
  67. Attribute VB_PredeclaredId = True
  68. Attribute VB_Exposed = False
  69. Private Sub Form_Load()
  70. Dragging = False
  71. VtChart1.AllowSeriesSelection = False ' So points can be selected
  72. VtChart1.DrawMode = VtChDrawModeBlit  ' To reduce flicker
  73. End Sub
  74. Private Sub VtChart1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  75.     Dim ThePart%, TheSeries%, ThePoint%, I3%, I4%
  76.     If Not Dragging Then
  77.         VtChart1.TwipsToChartPart X, Y, ThePart, TheSeries, ThePoint, I3, I4
  78.         If ThePart = VtChPartTypePoint Then
  79.             OldX = X
  80.             OldY = Y
  81.             DragSeries = TheSeries
  82.             DragPoint = ThePoint
  83.             Dragging = True
  84.         End If
  85.     End If
  86. End Sub
  87. Private Sub VtChart1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  88.     Dim ThePart%, TheSeries%, ThePoint%, I3%, I4%
  89.     Dim TheData As Double
  90.     Dim TheNull As Integer
  91.     If Dragging Then
  92.         VtChart1.DataGrid.GetData DragPoint, DragSeries, TheData, TheNull
  93.         If Y < OldY Then
  94.             OldY = Y
  95.             TheData = TheData + 1
  96.         Else
  97.             OldY = Y
  98.             TheData = TheData - 1
  99.         End If
  100.         VtChart1.DataGrid.SetData DragPoint, DragSeries, TheData, TheNull
  101.         VtChart1.Refresh
  102.         
  103.         ' Display Label To Show Current Value
  104.         With VtChart1.Plot.SeriesCollection.Item(DragSeries).DataPoints.Item(DragPoint).DataPointLabel
  105.             .LocationType = VtChLabelLocationTypeAbovePoint
  106.             .Component = VtChLabelComponentValue
  107.             .ValueFormat = "0.0"
  108.             .Backdrop.Frame.Style = VtFrameStyleSingleLine
  109.         End With
  110.         
  111.     End If
  112. End Sub
  113. Private Sub VtChart1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  114.     ' Turn Dragging Off
  115.     Dragging = False
  116.     ' Turn Point Label Off
  117.     With VtChart1.Plot.SeriesCollection.Item(DragSeries).DataPoints.Item(DragPoint).DataPointLabel
  118.         .LocationType = VtChLabelLocationTypeNone
  119.     End With
  120. End Sub
  121.